package Parts;

import Units.*;
import Utils.Array;
import Utils.Vector2;

public class HexagonTile {

	public enum HexagonState { Free, Occupied, StartTile, FinishTile, Baracks }
	
	private Vector2 _posArray;
	private Vector2 _posWorld;
	private HexagonState _state;
	private int _unitCount;
	private int _tag;
	private Array<Unit> _tileUnits;

	public HexagonTile(Vector2 arrayPos, HexagonState tileState){
		_posArray = arrayPos;
		_posWorld = new Vector2(_posArray.x * 78f, (66f * _posArray.y) - (33f * _posArray.x));
		_state = tileState;
	}
	
	public HexagonTile(Vector2 arrayPos, HexagonState tileState, int tileTag){
		_posArray = arrayPos;
		_posWorld = new Vector2(_posArray.x * 78f, (66f * _posArray.y) - (33f * _posArray.x));
		_state = tileState;
		_tileUnits = null;
		_unitCount = 0;
		_tag = tileTag;
	}
	
	public HexagonTile(Vector2 arrayPos, HexagonState tileState, Array<Unit> units, int tileTag){
		_posArray = arrayPos;
		_posWorld = new Vector2(_posArray.x * 78f, (66f * _posArray.y) - (33f * _posArray.x));
		_state = tileState;
		_tileUnits = units;
		_unitCount = _tileUnits == null ? 0 : units.size;
		_tag = tileTag;
	}
	
	public Vector2 getPositionWorld(){
		return _posWorld;
	}
	
	public Vector2 getPositionArray(){
		return _posArray;
	}
	
	public HexagonState getState(){
		return _state;
	}
	
	public void setState(HexagonState state){
		this._state = state;
	}
	
	public int getUnitCount(){
		return _unitCount;
	}
	
	public void setTag(int t){
		_tag = t;
	}
	
	public int getTag(){
		return _tag;
	}
	
	public Array<Unit> getUnits(){
		return _tileUnits;
	}
	
	public void setUnits(Array<Unit> units){
		_tileUnits = units;
	}
}
